package com.wt.struggle.goodbye.user.activity

import android.os.Bundle
import com.google.gson.reflect.TypeToken
import com.wt.struggle.goodbye.R
import com.wt.struggle.goodbye.base.Config
import com.wt.struggle.goodbye.base.ProActivity
import com.wt.struggle.goodbye.base.Send
import com.wt.struggle.goodbye.info.NetInfo
import com.wt.struggle.goodbye.info.NewsInfo
import kotlinx.android.synthetic.main.head.*

/**
 * 反馈记录
 */
class ReturnRecordActivity : ProActivity() {

    override fun handler(what: Int, arg1: Int, netInfo: NetInfo) {
        when (what) {
            Send.DELETE_TIE -> {
                if (netInfo.code == Config.SUCCESS) {
                    val data = netInfo.dataResult
                    if (data != null && data != "") {
                        val arr = gson!!.fromJson<ArrayList<NewsInfo>>(data,
                            object : TypeToken<ArrayList<NewsInfo>>() {}.type
                        )
                        if (arr.size != 0) {

                        } else {
                            showToastShort("暂无记录信息")
                        }
                    }
                }
            }
        }

    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.return_record_layout)
        tvTitle.text = "反馈记录"
        imageBack.setOnClickListener {
            finish()
        }

        getList()
    }

    private fun getList() {

        send!!.getRecordList(1, 20, handler)

    }
}